package com.service.business.member.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.service.business.base.controller.req.LoginReq;
import com.service.business.base.controller.req.PhoneRegisterReq;
import com.service.business.base.controller.req.RegisterReq;
import com.service.business.member.controller.rep.MemberTeamPageRep;
import com.service.business.member.controller.rep.TotalMemberTeamRep;
import com.service.business.member.controller.req.*;
import com.service.business.member.enums.MemberEnums;
import com.service.core.rest.response.CommonPageRep;
import com.service.dao.model.Member;
import com.service.business.member.controller.rep.MemberInfoRep;
import com.service.dao.po.MemberCache;

import java.util.List;
import java.util.Map;

/**
 * <dl>
 * <dt>back-end</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2015</dd>
 * <dd>Company: </dd>
 * <dd>CreateDate: 2019年09月19日</dd>
 * </dl>
 *
 * @author
 */
public interface MemberService extends IService<Member> {

    Member getMemberTop1(Integer memberId);

    Member getMemberById(Integer memberId);

    Member getMemberTop2(Integer memberId);

    Member getMemberByAccount(String userAccount, MemberEnums.Status status);

    /**
     * 会员邮箱注册
     * @param req
     * @return
     */
    MemberInfoRep doMemberEmailRegister(RegisterReq req);

    /**
     * 会员手机号码注册
     * @param req
     * @return
     */
    MemberInfoRep doMemberPhoneRegister(PhoneRegisterReq req);

    /**
     * 会员登录
     * @param loginReq
     * @return
     */
    MemberInfoRep doLoginMember(LoginReq loginReq);

    MemberInfoRep getMemberInfoByToken();

    void checkAndUpdateMemberGrade(Integer memberId);

    void checkAndUpdateMemberGrade(MemberCache memberCache);

    void checkAndUpdateMemberStarGrade(Integer memberId);

    void checkAndUpdateMemberStarGrade(MemberCache memberCache);

    void resetMemberLoginPwd(ResetPassReq resetPassReq);

    void resetMemberSafetyPwd(ResetPassReq resetPassReq);

    void modifyMemberLoginPwd(ModifyPwdReq modifyPwdReq);

    void modifyMemberSafetyPwd(ModifyPwdReq modifyPwdReq);

    void updateMemberInfo(MemberUpdateReq updateReq);

    void bindTwoFa(TwoFaReq twoFaReq);

    List<Member> selectByPidAndStatus(Integer memberId);

    List<Member> selectByPathAndStatus(Integer memberId);

    void updateMemberGrade(Integer memberId, Integer grade);

    void updateMemberStarGrade(Integer memberId, Integer grade);

    Integer countValidMemberByPath(Integer memberId, Integer grade);

    Integer countMemberByPidAndStarGrade(Integer memberId, List<Integer> grade);

    void validSafetyPwd(Integer memberId, String safePwd);

    CommonPageRep<MemberTeamPageRep> pageMemberTeam(MemberTeamPageReq pageReq);

    boolean isDirectRelative(Member user, Member toUser);

    List<Integer> getMemberPathList(String memberPath);

    List<MemberInfoRep> listByUserAccount(String userAccount);

    boolean checkTwoFa(TwoFaReq twoFaReq);

    Map getTwoFa();

    void unbindTwoFa(TwoFaReq twoFaReq);

    boolean faStatus();

    TotalMemberTeamRep totalMemberTeam();

    /**
     * @Description: 获取用户等级处理列表中的用户集合
     * @Author: ty
     * @Date: 2021/5/6 16:12
     * @param: [grades]
     * @return: java.util.List<java.lang.Integer>
     **/
    List<Member> getMemberIdsByGradeList(List<Integer> gradeList);
}
